<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>已买到宝贝</title>
    <script src="js/jquery-3.1.0.js"></script> 
    <script type="text/javascript">
    $(function(){
        $(".div_content:gt(0)").css("display","none");
        $(".navigation>li").click(function(){
            $(".navigation>li").removeClass("active");
            $(this).addClass("active");
            if($(this).html()=="所有订单"){
                $(".div_content").css("display","none");
                $(".div_content:eq(0)").css("display","block");
            }else  if($(this).html()=="买到的宝贝"){
                $(".div_content").css("display","none");
                $(".div_content:eq(1)").css("display","block");
            }else  if($(this).html()=="卖出的宝贝"){
                $(".div_content").css("display","none");
                $(".div_content:eq(2)").css("display","block");
            }
       });

    });
    </script>
    <link type="text/css" rel="stylesheet" href="css/BuyBaby.css">
    <style type="text/css">
    	a:HOVER {
			color: orangered;
		}
		p:HOVER {
			color: orangered;
		}
    </style>
</head>
<body>
    <div id="div_tz">
    <!-- 菜单栏  -->
        <ul class="navigation">
            <li class="active">所有订单</li>
            <li>买到的宝贝</li>
            <li>卖出的宝贝</li>
        </ul>
        <!-- 所有订单  -->
        <div class="div_content" style="padding-top: 0px;">
         <div class="div_tab" style="padding-top: 20px;">
            <table class="tab">
                <tr class="tab_tr1">
                    <th class="tab_wp">订单信息</th>
                    <th class="tab_dj">订购商品</th>
                    <th class="tab_sl">数量</th>
                    <th class="tab_danj">单价</th>
                    <th class="tab_sfk">实付款</th>
                    <th class="tab_jyzt">订单状态</th>
                    <th class="tab_cz">订单操作</th>
                </tr>
            </table>
        </div>
       		<c:choose>
				<c:when test="${orderListAll == '[]'}">
					<p class="p_kong">没有符合条件的物品，请尝试其他搜索条件!<p>
				</c:when>
				<c:otherwise>
					<c:forEach items="${orderListAll}" var="o">
					<div style="padding-top: 20px;">
						<table style=" width: 1000px;border: 1px solid #cccccc; text-align: center;
								border-collapse: separate;border-spacing: 4px 10px;">						
							<tr>
			                    <td class="tab_wp" style="text-align:left;padding-left:10px;">交易单号：${o.orderId }<br/>交易时间：${o.data }<br/>
									<c:if test="${o.buyUser.userId=='1'}">联系卖家：${o.telephone }</c:if>
									<c:if test="${o.buyUser.userId!='1'}">联系买家：${o.telephone }</c:if>
			                    											</td>
			                    <td class="tab_dj">${o.goods.goodName }</td>
			                    <td class="tab_sl">${o.count }</td>
			                    <td class="tab_danj">
			                    	<c:if test="${o.state==1&&o.buyUser.userId=='1'}"><p style="color: red;">￥${o.price}<p></c:if>
			                    	<c:if test="${o.state==1&&o.buyUser.userId!='1'}">￥<input id="pr" type="text" style="width: 50px;" placeholder="${o.price}"/></c:if>
			            			<c:if test="${o.state!=1}"><p style="color: red;">￥${o.price}<p></c:if>
			                    </td>
			                    <td class="tab_sfk"><p style="color: red;">￥${o.price*o.count}<p></td>
			                    <td class="tab_jyzt">
				                   		<c:if test="${o.state==1&&o.buyUser.userId=='1'}">待付款</c:if>
				                    	<c:if test="${o.state==2&&o.buyUser.userId=='1'}">待发货</c:if>
				                    	<c:if test="${o.state==3&&o.buyUser.userId=='1'}">待收货</c:if>
				                    	<c:if test="${o.state==4&&o.buyUser.userId=='1'}">待评价</c:if>
				                    	<c:if test="${o.state==5&&o.buyUser.userId=='1'}">交易成功</c:if>
				                    	<c:if test="${o.state==6&&o.buyUser.userId=='1'}">待评价</c:if>
				                    	<c:if test="${o.state==7&&o.buyUser.userId=='1'}">交易成功</c:if>
				                    	
				                    	<c:if test="${o.state==1&&o.buyUser.userId!='1'}">等待买家付款</c:if>
				                    	<c:if test="${o.state==2&&o.buyUser.userId!='1'}">需发货</c:if>
				                    	<c:if test="${o.state==3&&o.buyUser.userId!='1'}">已发货</c:if>
				                    	<c:if test="${o.state==4&&o.buyUser.userId!='1'}">需评价</c:if>
				                    	<c:if test="${o.state==5&&o.buyUser.userId!='1'}">需评价</c:if>
				                    	<c:if test="${o.state==6&&o.buyUser.userId!='1'}">等待买家评论</c:if>
				                    	<c:if test="${o.state==7&&o.buyUser.userId!='1'}">交易成功</c:if>
				                    	
			                    </td>
			                    <td class="tab_cz">
			                    	<c:if test="${o.state==1&&o.buyUser.userId=='1'}">
			                    		<a href="handle_fukuan?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><img src="img/ljfk.jpg"/></a>
						                <a href="handle_delete?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><p>取消订单</p></a>
			                    	</c:if>
			                    	<c:if test="${o.state==2&&o.buyUser.userId=='1'}">等待卖家发货</c:if>
			                    	<c:if test="${o.state==3&&o.buyUser.userId=='1'}"><a href="handle_queren?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><img src="img/qrsh.jpg"/></a></c:if>
			                    	<c:if test="${o.state==4&&o.buyUser.userId=='1'}">
			                    	<a href="handle_buypingj?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><img src="img/pj.jpg"/></a>
			                    	</c:if>
			                    	<c:if test="${o.state==5&&o.buyUser.userId=='1'}">交易成功</c:if>
			                    	<c:if test="${o.state==6&&o.buyUser.userId=='1'}"><a href="handle_buypingj?orderId=${o.orderId }"  target="baby" style="text-decoration: none;color: black;"><img src="img/pj.jpg"/></a></c:if>
			                    	<c:if test="${o.state==7&&o.buyUser.userId=='1'}">交易成功</c:if>
			                    	<c:if test="${o.state==1&&o.buyUser.userId!='1'}"><a href="JavaScript:;" onclick="location ='handle_gengjia?orderId=${o.orderId }&price='+document.getElementById('pr').value;" target="baby" style="text-decoration: none;color: black;"><img src="img/ggjg.jpg"/></a></c:if>
			                    	<c:if test="${o.state==2&&o.buyUser.userId!='1'}"><a href="handle_fahuo?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><img src="img/fh.jpg"/></a></c:if>
			                    	<c:if test="${o.state==3&&o.buyUser.userId!='1'}">等待买家确认收货</c:if>
			                    	<c:if test="${o.state==4&&o.buyUser.userId!='1'}"><a href="handle_salepingj?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><img src="img/pj.jpg"/></a></c:if>
			                    	<c:if test="${o.state==5&&o.buyUser.userId!='1'}"><a href="handle_salepingj?orderId=${o.orderId }" target="baby" style="text-decoration: none;color: black;"><img src="img/pj.jpg"/></a></c:if>
			                    	<c:if test="${o.state==6&&o.buyUser.userId!='1'}">等待买家评论</c:if>
			                    	<c:if test="${o.state==7&&o.buyUser.userId!='1'}">交易成功</c:if>
			                    	<p><a href="handle_xiangq?orderId=${o.orderId }" target="baby" style="color: red;text-decoration: none;">查看详情</a></p>
			                    </td>
			                </tr>
						</table>
					</div>
					</c:forEach>
				</c:otherwise>
			</c:choose>
        </div>
        
        <div class="div_content">
       		<iframe src="BuyBaby.jsp"></iframe>
        </div>
        
        <div class="div_content">
       		<iframe src="SaleBaby.jsp"></iframe>
        </div>

    </div>
</body>
</html>